package com.li.puzzle.viewpagerindicator;

import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

/**
 * Created by Administrator on 2016/11/24.
 */

public class FragmentIndicator extends Fragment {

    public static FragmentIndicator newInstance(String title) {

        Bundle args = new Bundle();
        args.putString("title", title);
        FragmentIndicator fragment = new FragmentIndicator();
        fragment.setArguments(args);
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        TextView tv = new TextView(getActivity());
        Bundle bundle = getArguments();
        if (bundle != null) {
            tv.setText(bundle.getString("title"));
        }
        tv.setGravity(Gravity.CENTER);
        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15);
        tv.setTextColor(Color.BLACK);
        return tv;
    }
}
